fix(launcher): make CLI sign-in and installs work off the machine's real environment - #659
Merged
Merged
Conversation
…eal environment Four failures with one shape: something the launcher spawns could not see the environment it needed, and the check that should have caught it looked somewhere else and passed. CodeBuddy signs into the wrong site. The CLI fronts two separate services (codebuddy.ai / codebuddy.cn) and keeps ONE session on disk, chosen by CODEBUDDY_INTERNET_ENVIRONMENT. The sign-in terminal opened bare, so it always signed in against the international site while an agent set to the China site ran with the variable pinned to `internal` and failed auth on every message. The terminal (and the per-agent Chat terminal) now carry the same value the adapter overlays on the agent's own runs. ...and the sign-in could never be confirmed. codebuddy had no probe at all, so verifyLogin was false however the login went and the poll ran out after five minutes. It joins DUAL_LOGIN_AGENTS with a creds-file probe reading the session file `/login` writes, in the CLI's extension data dir on all three platforms. A new `credsGuard` hook checks the session's own domain against the configured region — a session for the other site would otherwise read as a green Ready in front of an agent that cannot authenticate. Only `auth`/`auth.domain` are read; the token in the same file is never touched. The sign-in terminal went direct while the browser used the proxy, failing with "Client network socket disconnected before secure TLS connection was established" on a machine whose browser had just reported the login as successful. On macOS the terminal is not our child — osascript hands a script to the already-running Terminal.app — so it never saw the proxy this process had resolved. The same gap `adoptSystemProxyForChildren` documents for `kimi login`, which was only ever closed for the in-app piped path; the terminal-only CLIs (codebuddy, gemini, hermes) were the ones still exposed. The terminal script now carries it, with the user's own bypass list kept and 127.0.0.1 (where these sign-ins complete) off the tunnel. Installs could not find a user-installed tool. OpenWorker installs with `uv tool install`, uv lands in ~/.local/bin, and a GUI process inherits a shell-less PATH. install-preflight's probeUv searches ~/.local/bin and passed; installer.js's _buildShellEnv did not add it and the spawn died with exit 127. Both sides now agree: the launcher restores the user bin dirs on its own PATH at startup (appended, so anything the user configured still wins) and the core adds them as a last-resort fallback. Also fixed while in here: - runTerminal's Linux branch dropped extraEnv entirely, so Gemini's workspace trust and CodeBuddy's site pinning never reached a Linux terminal. - commandcode's probe read `whoami`, which reports an unreachable account service as an ordinary error on a CLEAN exit — indistinguishable from success under negative-only matching. It now reads `status`, the CLI's own auth check, with both directions named so an offline machine stays "unknown". - CODEBUDDY_AUTH_TOKEN counts as configured credentials (registry lists it beside the API key, but it is not an *_API_KEY). - OpenWorker's keyless providers (ollama, openai-codex) no longer read "No model API key" forever; openai-codex is labelled as the CLI sign-in it is. - _savedTypeEnvForProbe reads the connector's raw agent list, not getAgents() — that path derives health, health asks the probe, and the probe lands back there. Launcher 0.9.27 with release notes. 476 launcher tests, 1512 core tests.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four reported failures that turned out to share one shape: something the launcher spawns could not see the environment it needed, and the check that should have caught it looked somewhere else and passed.
1. CodeBuddy signs into the wrong site
The CLI fronts two separate services — codebuddy.ai / workbuddy.ai and codebuddy.cn / workbuddy.cn — and keeps one session on disk, selected by
CODEBUDDY_INTERNET_ENVIRONMENT.The sign-in terminal opened bare, so it always signed in against the international site. An agent configured for the China site then ran with the variable pinned to
internaland failed auth on every message, with a terminal that had just said "logged in". The reporter's screenshot showed the session runningHy4 preview, a model that only exists in the internationalproduct.json.The sign-in terminal — and the per-agent Chat terminal, which is the agent's own CLI — now carry the same value the adapter overlays on the agent's runs.
internationaldeliberately pins nothing: unset is the CLI's documented default and what lets its startup follow the session on disk, and there is noproduct.external.jsonto select.2. ...and a completed sign-in could never be confirmed
codebuddyhad no probe at all, soverifyLoginreturned false however the login went and the poll gave up after five minutes.It joins
DUAL_LOGIN_AGENTSwith a creds-file probe reading the session file/loginwrites — the CLI's extension data directory, on all three platforms, named after theauthentication.idin itsproduct.json.Because that one file covers every site, a new
credsGuardhook checks the session's own domain against the configured region. Without it the probe would trade one wrong answer for another: a session for the other site would read as a green Ready in front of an agent that cannot authenticate. Onlyauth/auth.domainare read; the token in the same file is never touched.3. The sign-in terminal went direct while the browser used the proxy
Reported as
Client network socket disconnected before secure TLS connection was established, on a machine whose browser had just reported the login as successful.On macOS the sign-in terminal is not our child —
osascripthands a script to the already-running Terminal.app — so it never saw the proxy this process had resolved from System Settings. This is the same gapadoptSystemProxyForChildrendocuments forkimi login, and it was only ever closed for the in-app piped path. The terminal-only CLIs (codebuddy, gemini, hermes) were the ones still exposed.proxyEnvForChildren()now writes it into the terminal script, both spellings, with the user's own bypass list preserved and127.0.0.1(where these sign-ins complete) kept off the tunnel.4. Installs could not find a user-installed tool
OpenWorker installs with
uv tool install, uv's own installer puts the binary in~/.local/bin, and a GUI process inherits a shell-less PATH.The two sides disagreed:
install-preflight.js'sprobeUvsearches~/.local/binand passed, theninstaller.js's_buildShellEnv— which only added/usr/local/binand/opt/homebrew/bin— spawned/bin/sh -c "uv tool install …"and got exit 127. The guard passed and the thing it was guarding failed, which is the worst of both answers.Both sides now agree. The launcher restores the user bin dirs on its own PATH at startup (appended, so anything the user configured still wins), and the core adds them to
_buildShellEnvas a last-resort fallback —unshift, because that loop prepends, and these must never shadow the runtime directories.Also fixed while in here
runTerminal's Linux branch droppedextraEnventirely, so Gemini's workspace trust and CodeBuddy's site pinning never reached a Linux terminal.whoami, which reports an unreachable account service asError: Connection error.on a clean exit — indistinguishable from success under negative-only matching, so an offline machine read as signed in. It now readsstatus, the CLI's own authentication check, with both directions named so an offline machine stays "unknown" rather than getting a wrong verdict.CODEBUDDY_AUTH_TOKENcounts as configured credentials. The registry lists it beside the API key as a first-class auth path, but it is not an*_API_KEY, so a token-configured agent read "Login required".ollama,openai-codex) no longer read "No model API key" for as long as they run;openai-codexis labelled as the CLI sign-in it actually is._savedTypeEnvForProbereads the connector's raw agent list rather thangetAgents()— that path derives health, health asks the sign-in probe, and the probe would have landed back there, recursing on every dual-login agent.Scope
The core change (
installer.js) only reaches users when@openagents-org/agent-launchernext ships; the launcher-side PATH repair fixes the OpenWorker install on its own against the pinned 0.2.177.One case is deliberately not covered: a machine with no proxy configured anywhere that simply cannot reach
www.codebuddy.ai. Nothing here can fix that — the answer is the China site, or a proxy in Settings → Network, which now reaches the login terminal.Verification
CODEBUDDY_AUTH_TOKEN)Anyone who signed in to CodeBuddy before this release should sign in once more from the Login button — the existing session may belong to the other site.
🤖 Generated with Claude Code